﻿#if UNITY_EDITOR
/// <summary>
/// 编译工具帮助类
/// </summary>
public static class ESF_CompilerHelper
{
    /// <summary>
    /// 返回指定值的代码字符
    /// </summary>
    /// <param name="_value">值</param>
    /// <returns>代码字符</returns>
    public static string ToCodeString(object _value)
    {
        string result = _value.ToString();
        if (_value is bool)
        {
            result = _value.ToString().ToLower();
        }
        else if (_value is string)
        {
            result = _value.ToString().EncodeToJson();
        }
        return result;
    }

    /// <summary>
    /// 将指定字符串转换为变量名
    /// </summary>
    /// <param name="_value">字符串</param>
    /// <returns>变量名</returns>
    public static string ToCodeVariableName(string _value)
    {
        return _value.ESF_OnlyCNUAndOtherReplaceU();
    }

    /// <summary>
    /// 将指定字符串转换为HashCode
    /// </summary>
    /// <param name="_value">字符串</param>
    /// <returns>变量名</returns>
    public static int ToUniqueHashCode(string _value)
    {
        return _value.ESF_UniqueHashCode();
    }

}
#endif
